<?php

namespace App\Http\Admin\Services\Media\BliUper;

use App\Exceptions\InvalidRequestException;
use App\Http\Admin\Services\BaseService;
use App\Http\Models\BliUper;
use Illuminate\Support\Facades\DB;

class BliUperService extends BaseService
{

    public function BliData($conditions = []){

        $modal  =   BliUper::select(['mid','name','face','fans','sign','level','sex','official','cate','updated_at']);

        if(!empty($conditions['mid'])){
            $modal  =   $modal->where('mid',$conditions['mid']);
        }
        if(!empty($conditions['name'])){
            $modal  =   $modal->where('name','like',"%".$conditions['name']."%");
        }

        if(!empty($conditions['key'])){
            $modal  =   $modal->orderBy($conditions['key'],$conditions['order']);
        }

        $modal  =   $modal->paginate(30);

        return $modal;

    }

}